package com.sean.designpatterns.structure.flyweight;

import java.util.HashMap;
import java.util.Hashtable;

public class ShapeFactory {
    private static final HashMap<String,Shape> circleMap= new HashMap<>();

    public static Shape getShape(String color){
        Shape shape = circleMap.get(color);
        if(shape==null){
            System.out.println("create the circle color "+color);
            shape = new Circle(color);

            circleMap.put(color,shape);
        }
        return shape;
    }

}
